<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/**
 * Basketball extension for Joomleague
 * @version $Id: show_table.tpl.php 97 2008-02-23 22:56:51Z julien.vonthron $
 * @package JlgBasketballExtension
 * @copyright Copyright (C) 2007 Julien Vonthron. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * JlgBasketballExtension is free software and parts of it may contain or be derived from the
 * GNU General Public License or other free or open source software licenses.
 * 
 * contact: julien.vonthron[at]gmail.com 
 *   
 * Joomleague is a League Management and Prediction Game for Joomla!
 * Homepage: http://www.joomleague.de 
 *  
 */

  /**
   * compares teams ppg.
   *
   * @param team $a
   * @param team $b
   * @return boolean
   */
  function ppgCmp( &$a, &$b)
  {
    if ($a->cnt_matches == 0) {
      return false;
    }
    if ($b->cnt_matches == 0) {
      return true;
    }
    $res = ($a->sum_matchpart1_result / $a->cnt_matches - $b->sum_matchpart1_result / $b->cnt_matches);
    return $res;
  }
  
	/**
   * compares teams ppg against.
   *
   * @param team $a
   * @param team $b
   * @return boolean
   */
  function ppgaCmp( &$a, &$b)
  {
    if ($a->cnt_matches == 0) {
      return false;
    }
    if ($b->cnt_matches == 0) {
      return true;
    }
    $res = ($a->sum_matchpart2_result / $a->cnt_matches - $b->sum_matchpart2_result / $b->cnt_matches);
    return $res;
  }
  
	/*
	 * Displays ranking table heading according to config
	 */
	function show_ranking_heading($type, &$config) {
	  global $joomleague;
	
	  $colspanHead      = 4;
	  if ($config['show_logo_small_table']>0){
	    $colspanHead++;
	  }
	  $colspanSingleTab = 0;
	  if($config['show_cnt_matches']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_won']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_draw']==1){
	    $colspanSingleTab++;
	  }
	  if($joomleague->use_legs==1){
	    $colspanSingleTab++;
	  }
	  if($joomleague->use_legs==1&&$config['show_legs_diff']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_lost']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_winpct']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_gameback']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_results']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_diff']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_points']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_bonus_points']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_start_points']==1){
	    $colspanSingleTab++;
	  }
	  if($config['show_ppg']==1 || 1){
	    $colspanSingleTab++;
	  }
	  if($config['show_ppga']==1 || 1){
	    $colspanSingleTab++;
	  }
	  
	  // Test for triple table
	  if($type==3){
	    ?>
	
	<tr>
	  <td align="left" width="50" colspan="<?PHP echo $colspanHead; ?>">&nbsp;</td>
	  <td colspan="<?PHP echo $colspanSingleTab; ?>" align="center"
	    style="text-align: center"><b><?PHP echo _JL_MODULE_RANKING_OVERALL; ?></b>
	  </td>
	  <td colspan="<?PHP echo $colspanSingleTab; ?>" align="center"
	    style="text-align: center"><b><?PHP echo _JL_MODULE_RANKING_HOME; ?></b>
	  </td>
	  <td colspan="<?PHP echo $colspanSingleTab; ?>" align="center"
	    style="text-align: center"><b><?PHP echo _JL_MODULE_RANKING_AWAY; ?></b>
	  </td>
	</tr>
	    <?PHP } ?>
	<tr>
	  <td align="left" class="sectiontableheader" width="50" colspan="3"><?php 
	  HTML_joomleague::print_column_heading_sort( _JL_TABLE_POSITION , "rank", $config, "ASC");
	  //echo _JL_TABLE_POSITION;
	  ?></td>
	  <?php
	  if ($config['show_logo_small_table']>0){
	    ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader" width="50">&nbsp;</td>
	    <?php }
	    ?>
	  <td align="left" class="sectiontableheader"><?php 
	  HTML_joomleague::print_column_heading_sort( _JL_TABLE_TEAM , "name", $config, "ASC");
	  //echo _JL_TABLE_TEAM;
	  ?></td>
	  <?php
	  // three tables next to each other
	  if($type==3)
	  {
	    $tabcols=3;
	  }
	  else
	  {
	    $tabcols=1;
	  }
	  for ($tabs=0; $tabs<$tabcols; $tabs++)
	  {
	    if($config['show_cnt_matches']==1){
	      ?>
	  <td align="center" class="sectiontableheader" style="text-align:center;<?php if($type==3) { echo 'border-left: 1px solid;';}?>"><?php
	  echo _JL_TABLE_MATCHES;?></td>
	  <?php
	}
	if($config['show_won']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( _JL_TABLE_WON , "won", $config);
	    ?></td>
	    <?php
	}
	if($config['show_lost']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( _JL_TABLE_LOSS , "loss", $config);
	    ?></td>
	    <?php
	}
	if($config['show_draw']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( _JL_TABLE_DRAW , "draw", $config);
	    ?></td>
	    <?php
	}
	if($config['show_winpct']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( _JL_TABLE_WINPCT , "winpct", $config);
	    ?></td>
	    <?php
	}
	if($config['show_gameback']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php echo _JL_TABLE_GB;?></td>
	    <?php
	}
	$colspan = 0;
	if($joomleague->use_legs==1){
	  $colspan++;
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php
	    if ($config['alternative_legs']=="") echo _JL_TABLE_LEGS;
	    else echo $config['alternative_legs'];
	    ?></td>
	    <?php
	}
	if($joomleague->use_legs==1&&$config['show_legs_diff']==1){
	  $colspan++;
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php
	    if ($config['alternative_legs_diff']=="") echo _JL_TABLE_LEGS_DIFF;
	    else echo $config['alternative_legs_diff'];
	    ?></td>
	    <?php
	}
	if($config['show_results']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php
	    if ($config['alternative_goal']=="") $goals = _JL_TABLE_GOALS;
	    else $goals = $config['alternative_goal'];
	    HTML_joomleague::print_column_heading_sort( $goals , "goalsp", $config);
	    ?></td>
	    <?php
	}
	if($config['show_diff']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( _JL_TABLE_DIFF , "diff", $config);
	    ?></td>
	    <?php
	}
	if($config['show_points']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( _JL_TABLE_POINTS , "points", $config);
	    ?></td>
	    <?php
	}
	if($config['show_bonus_points']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( _JL_TABLE_BONUS_POINTS , "bonus", $config);
	    ?></td>
	    <?php
	}
	if($config['show_start_points']==1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( _JL_TABLE_START_POINTS , "start", $config);
	    ?></td>
	    <?php
	}
	if($config['show_ppg']==1 || 1)
	{
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( 'PPG' , "ppg", $config);
	    ?></td>
	    <?php
	}
	if($config['show_ppga']==1 || 1){
	  ?>
	  <td align="center" style="text-align: center"
	    class="sectiontableheader"><?php HTML_joomleague::print_column_heading_sort( 'PPGA' , "ppga", $config);
	    ?></td>
	    <?php
	}
	}
	?>
	</tr>
	<?php
	return $colspanHead + $colspanSingleTab;
	}

	/**
	 * Displays each row of ranking table
	 *
	 * @param object $a curent ranking
	 * @param object $b previous ranking
	 * @param object $homeRank home ranking
	 * @param object $awayRank away ranking
	 * @param unknown_type $type type of ranking
	 * @param array $config config
	 */	
	function show_ranking_entries(&$a, &$b, $homeRank, $awayRank, $type, &$config) {
	  global $joomleague, $database;
	  $counter=1;
	  $k = 0;
	  $j = 0;
	  $temprank=0;
	  $tempoldrank=0;
	  $colors = $joomleague->getColors($config['colors']);
	  //print_r($colors);
	  $current_round = intval( mosGetParam( $_REQUEST, 'r', $joomleague->current_round ) );
	  $favteam=explode(",", $joomleague->fav_team);
	  if (isset($_REQUEST['order'])) {
	    //reorder table according to criteria
	    switch ($_REQUEST['order']) {
	      case 'name':
	        uasort( $a, array("HTML_joomleague","teamNameCmp" ));
	        break;
	      case 'rank':
	        break;
	      case 'won':
	        uasort( $a, array("HTML_joomleague","wonCmp" ));
	        break;
	      case 'draw':
	        uasort( $a, array("HTML_joomleague","drawCmp" ));
	        break;
	      case 'loss':
	        uasort( $a, array("HTML_joomleague","lossCmp" ));
	        break;
	      case 'winpct':
	        uasort( $a, array("HTML_joomleague","winpctCmp" ));
	        break;
	      case 'goalsp':
	        uasort( $a, array("HTML_joomleague","goalspCmp" ));
	        break;
	      case 'diff':
	        uasort( $a, array("HTML_joomleague","diffCmp" ));
	        break;
	      case 'points':
	        uasort( $a, array("HTML_joomleague","pointsCmp" ));
	        break;
	      case 'start':
	        uasort( $a, array("HTML_joomleague","startCmp" ));
	        break;
	      case 'bonus':
	        uasort( $a, array("HTML_joomleague","bonusCmp" ));
	        break;
	      case 'ppg':
	        uasort( $a, "ppgCmp" );
	        break;
	      case 'ppga':
	        uasort( $a, "ppgaCmp" );
	        break;
	    }
	    if ($_REQUEST['dir']=='DESC') $a=array_reverse($a, true);
	  }
	
	  foreach($a as $akey=>$aval){  
	    $class = ($k == 0)? $config['style_class1'] : $config['style_class2'];
	
	    $color = "";
	    if(isset($colors[$j]["from"]) && $counter == $colors[$j]["from"]) $color = $colors[$j]["color"];
	
	    if(isset($colors[$j]["from"]) && isset($colors[$j]["to"])&&($counter > $colors[$j]["from"] && $counter <= $colors[$j]["to"])) $color = $colors[$j]["color"];
	    if(isset($colors[$j]["to"]) && $counter == $colors[$j]["to"]) $j++;
	
	    $format = "%s";
	
	    if(in_array($aval->team->id, $favteam) && $config['fav_highlight_type']==1){
	       
	      if(trim($joomleague->fav_team_color) != "") $color = $joomleague->fav_team_color;
	      $format = "%s";
	
	    }
	
	    //GB calculation, store wins and loss count of the team in first place
	    if ($aval->rank == 1 && $config['show_gameback']==1 )
	    {
	      $ref_won = $aval->cnt_won;
	      $ref_lost = $aval->cnt_lost;
	    }
	
	    ?>
	<tr class="<?php echo $class;?>">
	  <td valign="top"
	  <?php if($color!='') { echo ' style="background-color: '.$color.'"'; }?>
	    align="right" nowrap="nowrap"><?php
	    if ($aval->rank!=$temprank) printf($format, $aval->rank);
	    else echo "-";
	    //printf($format, $counter);
	    ?></td>
	  <td valign="top"
	  <?php if($color!='') { echo " style='background-color: ".$color."'"; }?>><?php
	  if (isset($b[$akey]->rank)){
	    echo '<img align="middle" src="'.JL_TEMPLATE_FOLDERS_URL.'/images/';
	    if ($aval->rank==$b[$akey]->rank||$b[$akey]->rank=="") echo "same";
	    elseif ($aval->rank<$b[$akey]->rank) echo "up";
	    elseif ($aval->rank>$b[$akey]->rank) echo "down";
	    echo '.png" alt="" title="" />';
	  }
	  echo '</td><td valign="top" nowrap="nowrap" style="background-color:'
	  .$color.'" align="right">';
	  echo '<span class="small">';
	  print ($config['last_ranking']==1 && isset($b[$akey]->rank)) ? sprintf("(%s)",$b[$akey]->rank) : '';?>
	  </span></td>
	  <?php
	  if ($config['show_logo_small_table'] > 0) { ?>
	  <td valign="top"
	  <?php if($color!='') { echo ' style="background-color: '.$color.'"'; }?>
	    align="center"><?php 
	    HTML_joomleague::showClubIcon($aval->team, $config['show_logo_small_table']);?>
	  </td>
	  <?php
	}
	?>
	  <td valign="top" nowrap="nowrap"
	  <?php if($color!='') { echo ' style="background-color: '.$color.'"'; }?>
	    align="left"><?php  
	    $config['highlight_fav'] = in_array($aval->team->id, $favteam) ? 1 : 0;
	    echo HTML_joomleague::formatTeamname ($aval->team, 't'.$aval->team->id, $config, $config['highlight_fav']);
	    ?></td>
	    <?php
	    if($type==3)
	    {
	      $tabcols=3;
	    }
	    else
	    {
	      $tabcols=1;
	    }
	    for ($tabs=0; $tabs < $tabcols; $tabs++)
	    {
	      if ($tabs==0)
	      {
	        $showRow = $aval;
	      }
	      else
	      {
	        // search correct row
	        $otherrow = 0;
	        if ($tabs==1)
	        {
	          foreach ($homeRank AS $key => $value)
	          //while ($homeRank[$otherrow]->team->teamtoolid != $aval->team->teamtoolid)
	          {
	            //if ($key == $aval->team->teamtoolid) $otherrow++;
	            if (isset($homeRank[$key]->team->teamtoolid) && $homeRank[$key]->team->teamtoolid == $aval->team->teamtoolid) $showRow = $homeRank[$key];
	          }
	          //$showRow = $homeRank[$otherrow];
	
	        }
	        else
	        {
	          foreach ($awayRank AS $key => $value)
	          //while ($awayRank[$otherrow]->team->teamtoolid != $aval->team->teamtoolid)
	          {
	            //$otherrow++;
	            if (isset($awayRank[$key]->team->teamtoolid) && $awayRank[$key]->team->teamtoolid == $aval->team->teamtoolid) $showRow = $awayRank[$key];
	          }
	          //$showRow = $awayRank[$otherrow];
	        }
	      }
	      // table total
	      if($config['show_cnt_matches']==1){
	        ?>
	        <td valign="top" <?php 
	          if($color!='' && $type==3)
	            echo ' style="text-align:center;border-left: 1px solid; background-color: '.$color.'"';
	          else if($color!='') echo ' style="text-align:center;background-color: '.$color.'"';
	          else if($type==3) echo ' style="text-align:center;border-left: 1px solid"'; 
	          else echo ' style="text-align:center;"';
	        ?> align="center"><?php 
	          printf($format, $showRow->cnt_matches);
	          ?>&nbsp;</td>
	        <?php
	      }
	      if($config['show_won']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        printf($format, $showRow->cnt_won);?>&nbsp;</td>
	        <?php
	      }
	      if($config['show_lost']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        printf($format, $showRow->cnt_lost);?>&nbsp;</td>
	        <?php
	      }
        if($config['show_draw']==1){
          ?>
          <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
          printf($format, $showRow->cnt_draw);?>&nbsp;</td>
          <?php
        }
	      if($config['show_winpct']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        if (($showRow->cnt_won+$showRow->cnt_lost+$showRow->cnt_draw) > 0) {
	          printf($format, sprintf("%.3F",$showRow->cnt_won/($showRow->cnt_won+$showRow->cnt_lost+$showRow->cnt_draw)));
	        }
	        else printf($format, sprintf("%.3F",$showRow->cnt_won));
	        ?>&nbsp;</td>
	        <?php
	      }
	      if($config['show_gameback']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center">
	        <?php printf($format,
	        round( (($ref_won - $showRow->cnt_won) - ($ref_lost - $showRow->cnt_lost))/2, 1)
	        );?> &nbsp;</td>
	        <?php
	      }
	      if($joomleague->use_legs==1){
	        ?>
	        <td valign="top" align="center" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>"><?php
	        printf($format, sprintf("%s:%s", $aval->sum_matchpart1_legs, $aval->sum_matchpart2_legs));?>&nbsp;</td>
	        <?php
	      }
	      if($joomleague->use_legs==1&&$config['show_legs_diff']==1){
	        ?>
	        <td valign="top" align="center" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>"><?php
	        printf($format, $aval->diff_matchpart_legs);?>&nbsp;</td>
	        <?php
	      }
	      
	      if($config['show_results']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        printf($format, sprintf("%s:%s", $showRow->sum_matchpart1_result, $showRow->sum_matchpart2_result));?>&nbsp;</td>
	        <?php
	      }
	      if($config['show_diff']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        printf($format, $showRow->diff_matchpart_results);?>&nbsp;</td>
	        <?php
	      }
	      if($config['show_points']==1 && $config['show_negative_points']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        printf($format, sprintf("%s:%s", $showRow->sum_points, $showRow->neg_points));?>&nbsp;</td>
	        <?php
	      }
	      elseif($config['show_points']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        printf($format, $showRow->sum_points);?>&nbsp;</td>
	        <?php
	      }
	      if($config['show_bonus_points']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        printf($format, $showRow->bonus_points);?>&nbsp;</td>
	        <?php
	      }
	      if($config['show_start_points']==1){
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center"><?php
	        printf($format, $aval->team->start_points);?>&nbsp;</td>
	        <?php
	      }
	      if($config['show_ppg']==1 || 1)
	      {
	        ?>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center">
	          <?php
	          if ( $showRow->cnt_matches ) {
	            printf( $format, sprintf("%.1f", $showRow->sum_matchpart1_result / $showRow->cnt_matches));
	          }
	          else {
	            echo '-';
	          }
	          ?>
	        </td>
	        <td valign="top" style="text-align:center;<?php if($color!='') { echo 'background-color:'.$color; }?>" align="center">
	          <?php
	          if ( $showRow->cnt_matches ) {
	            printf( $format, sprintf("%.1f", $showRow->sum_matchpart2_result / $showRow->cnt_matches));
	          }
	          else {
	            echo '-';
	          }
	          ?>
	        </td>
	        <?php
	      }
	      }
	      ?>
	      </tr>
	      <?php
	      $k = 1 - $k;
	      $counter++;
	      $temprank=$aval->rank;
	    }
	  }
		
/*
 * START DISPLAY
 */ 

if ($jl_func != 'showresultsrank') {
?>
<a name="jl_top" id="jl_top"></a>
<!-- Header with Project Name-->
<?php if ($table_config['show_project_heading'] == "1" OR $overall_config['show_project_heading'] == "1") { ?>
<div class="componentheading"<?php
if ($table_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1") echo ' style="float:left;"';?>><?php
echo HTML_joomleague::showTitle($joomleague, $overall_config['project_heading_type']); ?></div>
<!-- Druckfunktion -->
<?php if ($table_config['show_print_button'] == "1" OR $overall_config['show_print_button'] == "1") {
HTML_joomleague::PrintIcon( $row, $params, false, '' );
};?>
<!-- Druckfunktion Ende -->
<?php } ?>
<!-- Header END -->
<?php
}
?>
<!-- section header e.g. ranking, results etc. -->
<table class="contentpaneopen" width="100%">
 	<tr>
   <td class="contentheading">
       <?php if ($table_config['show_section_heading']==1)	HTML_joomleague::show_ranking_title($table_config);?>
   </td>
 </tr>
<?php
if ($jl_func != 'showresultsrank') { ?>
 <tr>
   <td align="left">
      <?php if ($table_config['show_ranking_dropdown']==1) { echo HTML_joomleague::rankingnav($rounds, $type, $from, $to, $divLevel, $table_config);}?>
   </td>
  </tr>
<?php
}
?>
</table>
<!-- section header e.g. ranking, results etc. END -->

<br />

<!-- content -->
<?php

foreach ( $current_ranking as $key=>$cu_rk ) {
  $thisawayrank = (isset($awayRank[$key])) ? $awayRank[$key] : NULL;
  $thishomerank = (isset($homeRank[$key])) ? $homeRank[$key] : NULL;
  if ($key) {
    echo '<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0"><tr><td class="contentheading">';
      HTML_joomleague::show_ranking_division_title($key);
    echo '</td></tr></table>';
  }
  ?><div style="width:99%;height:auto;overflow:auto;text-align:center;" align="center">
  <table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
  <?php
  show_ranking_heading($type, $table_config);
  show_ranking_entries($cu_rk, $previous_ranking[$key], $thishomerank, $thisawayrank, $type, $table_config);
  ?>
  </table></div><br/>
  <?php
}
?>

<!-- ranking END -->
<!-- colors legend START -->
<?php if ($table_config['show_colors_legend']==1){;?>
<br />
<table width="96%" align="center" cellpadding="3" cellspacing="0">
  <tr>
      <?php
       HTML_joomleague::show_colors_legend($colors);
      ?>
  </tr>
</table>
<?php };?>
<!-- colors legend END -->
<!-- if available points manipulations with explanations START -->
<?php
if ($table_config['show_start_points'] == 1) {
HTML_joomleague::show_manipulations($result);
}
 ?>
<!-- if available points manipulations with explanations END -->
<!-- matchdays pageNav -->
<?php
if (isset($pageNav)&&$table_config['show_matchday_pagenav']==1) { ?>
<table width="96%" align="center" border="0" cellpadding="3" cellspacing="0">
  <tr>
   <td align="center">
   <br />
   <?php echo $pageNav ?>
<br /></td>
  </tr>
</table>
<?php
} ?>
<!-- matchdays pageNav END -->

<!-- Print Button START -->
<?php if ($table_config['show_back_button'] > 0 OR $overall_config['show_back_button'] > 0) {;?>
<?php if ($table_config['show_back_button'] == "1" OR $overall_config['show_back_button'] == "1") echo '<div align="left">'; else echo '<div align="right">';?>
<?php
$params = new mosParameters( '' );
$params->def( 'back_button', true );
$params->def( 'popup', false );
mosHTML::BackButton( $params );
?></div> 
<?php };?>
<!-- Print Button END -->
